package com.aaa.controller;

import com.aaa.entity.Doctor;
import com.aaa.service.DoctorService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@CrossOrigin
@RequestMapping("doctor")
public class DoctorController {
    @Autowired
    DoctorService ds;

    @RequestMapping("findDoctor")
    public PageInfo findDoctor(String dynName,String docName,String grand,int page,int size){
        return ds.findDoctor(dynName,docName,grand,page,size);
    }

    @RequestMapping("findDoctorRepeat")
    public PageInfo findDoctorRepeat(int page,int size){
        return ds.findDoctorRepeat(page,size);
    }
    @RequestMapping("findDoctorDesc")
    public List<Map> findDoctorDesc(){
        return ds.findDoctorDesc();
    }

    @RequestMapping("addDoctor")
    public int addDoctor(Doctor doctor){
        return ds.addDoctor(doctor);
    }

    @RequestMapping("doctorDel")
    public int doctorDel(int docId){
        return ds.doctorDel(docId);
    }

    @RequestMapping("updateDoctor")
    public int updateDoctor(Doctor doctor){
        return ds.updateDoctor(doctor);
    }
    @RequestMapping("findDoctorById")
    public Map findDoctorById(int docId){
        return ds.findDoctorById(docId);
    }

    @RequestMapping("checkDoctor")
    public  int checkDoctor(int fk_cid,int fk_dynId,String docSurname,String docName){
        System.out.println(fk_cid+":"+fk_dynId+":"+docSurname+":"+docName);
        return ds.checkDoctor(fk_cid,fk_dynId,docSurname,docName);
    }//检测医家是否重复，返回重复的个数
}
